var form;
var $;
var table;
var layer;
layui.use(['form','jquery','table','layer'],function() {
    form = layui.form;
    $ = layui.jquery;
    table = layui.table;
    layer = layui.layer;
});
$.ajax({
    url:'/Product/productCategroys',
    dataType:'json',
    success:function (data) {
        $.each(data.data, function (index, item) {
            $('#proTitle').append(new Option(item.title, item.categroyId));// 下拉菜单里添加元素
        });
        layui.form.render("select");
    }
});

function reset() {
    $('input[name = title]').val("");
    $('select[name=selProTitle]').val('0');
    $('select[name=selStat]').val('0');
    $('input[name = name]').val("");
    $('input[name = price]').val("");
    $('input[name = label]').val("");
    parent.$('input[name=stat]').val("");
    parent.$('input[name=proTitle]').val("");
}
function search() {
    var productCode = $('input[name = productCode]').val();
    var selProTitle =  $('select[name=selProTitle]').val();
    var selStat = $('select[name=selStat]').val();
    var name = $('input[name = name]').val();
    var price = $('input[name = price]').val();
    var productLabel = $('input[name = label]').val();
    $.ajax({
        url:'/Product/queryProduct',
        dataType:'json',
        data:{
            "productCode":productCode,"categoryId":selProTitle,"productSate":selStat,"productName":name,
            "currentpriceProduct":price,"productLabel":productLabel
        },
        success:function (data) {
            parent.tab(data.data);
            var layer = parent.layer;
            layer.close(layer.index);
        }
    });
}